package cn.luowb.checkchat.dao.mapper;

import cn.luowb.checkchat.dao.entity.PostDO;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Update;

/**
 * @author heimenkyou
 * @description 针对表【post(帖子)】的数据库操作Mapper
 * @createDate 2025-09-01 19:07:09
 * @Entity cn.luowb.checkchat.dao.entity.PostDO
 */
public interface PostMapper extends BaseMapper<PostDO> {

    /**
     * 增加点赞数
     */
    @Update("UPDATE post SET like_count = like_count + #{delta} WHERE id = #{id}")
    void incrementLikeCount(long id, int delta);

    /**
     * 增加评论数
     *
     * @param postId 帖子ID
     */
    @Update("UPDATE post SET comment_count = comment_count + 1 WHERE id = #{postId}")
    void incrementCommentCount(Long postId);
}




